//*************** Object.is()  *****************/

//* 判断两个值想不想等
Object.is('foo', 'foo')
// true
Object.is({}, {})
// false


//*************** Object.assign()  *****************/

const target = { a: 1 };
const source1 = { b: 2 };
const source2 = { c: 3 };

Object.assign(target, source1, source2);
target // {a:1, b:2, c:3}

//*  为对象添加属性
class Point {
    constructor(x, y) {
        Object.assign(this, { x, y });
    }
}

//*  为对象添加方法
function SomeClass(){}
Object.assign(SomeClass.prototype, {
    someMethod(arg1, arg2) {
        
    },
    anotherMethod() {
        
    }
});

// 等同于下面的写法
SomeClass.prototype.someMethod = function (arg1, arg2) {
    
};
SomeClass.prototype.anotherMethod = function () {
    
};


//*************** Object.keys()，Object.values()，Object.entries()  *****************/

let {keys, values, entries} = Object;
let obj = { a: 1, b: 2, c: 3 };

for (let key of keys(obj)) {
  console.log(key); // 'a', 'b', 'c'
}

for (let value of values(obj)) {
  console.log(value); // 1, 2, 3
}

for (let [key, value] of entries(obj)) {
  console.log([key, value]); // ['a', 1], ['b', 2], ['c', 3]
}

